perm filename FIND.TES[UP,DOC]1 blob sn#002791 filedate 1972-10-09 generic text, type T, neo UTF8
This file is FIND.DOC[S,DOC]			Larry Tesler 11/18/71

				FIND

	.R FIND
	FILE = FOO
	KEY = BAZ

If FOO=PHONE, the A.I. Project Phone Directory is  read.   Otherwise,
the file FOO is read.

The  file is logically divided into paragraphs.  A paragraph consists
of twenty or fewer consecutive non-blank lines on one page.

FIND searches the file FOO for paragraphs that contain the  key  BAZ.
Each paragraph containing the key is a "HIT" and is typed out.  Also,
the hits are counted and the count is printed at the  end.   Finally,
"KEY = " is printed again and another key can be entered.

The key may be terminated by cr-lf or  by  altmode.   <CR-LF>  causes
FIND  to  search for an Exact Match.  <ALTMODE> causes FIND to search
for a Template Match.    A  Template  Match  recognizes  two  special
symbols  in  the  key:  Space  (one  or  more consecutive spaces) and
Triple-Dot (three or more consecutive dots).   A  Space  in  the  key
matches  zero  or  more  spaces, tabs, and CRLFs in the Paragraph.  A
Triple Dot in the key matches zero or more  arbitrary  characters  in
the Paragraph. Furthermore, in a Template Match, upper and lower case
letters are equated.

Example:

	.R FIND
	FILE = PHONE
	KEY = john...lathrop <ALTMODE>

	27300   Prof.	John	McCarthy	JMC 300	2	John
	27400   45	4430	MTC*/RT*	P
	27500   (9) 321-7580	846 Lathrop Dr.	Stanford

	1 HIT ON KEY = john...lathrop

	KEY =

To search the phone directory for an Exact Match takes about 2.5  cpu
seconds; to search for a Template Match takes 3 to 5 cpu seconds.